package com.zhangfb95.crosschain.infra.statuscode;

import java.util.Objects;

/**
 * 状态码抽象接口
 *
 * @author zhangfubing
 */
public interface IStatusCode {

    /**
     * 状态码
     */
    String getCode();

    /**
     * 描述信息
     */
    String getMsg();

    default boolean is(String code) {
        return Objects.equals(getCode(), code);
    }

    default boolean is(IStatusCode statusCode) {
        if (statusCode == null) {
            return false;
        }
        return is(statusCode.getCode());
    }
}
